﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Windows.Data.Json;

namespace Xiaowei.ViewModel
{
    public class AlertViewModel
    {
        public long ID { get; set; } = 0;
        public string Event { get; set; } = "";
        public string TimeString { get; set; } = "";



        public string DataString
        {
            get
            {
                JsonObject jsobj = new JsonObject();
                jsobj.Add("ID", JsonValue.CreateNumberValue(ID));
                jsobj.Add("Event", JsonValue.CreateStringValue(Event));
                jsobj.Add("TimeString", JsonValue.CreateStringValue(TimeString));
                return jsobj.ToString();
            }
            set
            {
                JsonObject jsobj = JsonObject.Parse(value);
                ID = (long)jsobj["ID"].GetNumber();
                Event = jsobj["Event"].GetString();
                TimeString = jsobj["TimeString"].GetString();
            }
        }
    }
}
